//
//  YIem_SY_One_Bottom_View.m
//  B段_开眼
//
//  Created by YIem on 16/5/6.
//  Copyright © 2016年 Howie. All rights reserved.
//

#import "YIem_SY_One_Bottom_View.h"
#import "YIem_SY_One_Model.h"
@interface YIem_SY_One_Bottom_View ()

@property (nonatomic, strong) UILabel *labeldate;
@property (nonatomic, strong) UILabel *labelWeather;
@property (nonatomic, strong) UILabel *labelWind;
@property (nonatomic, strong) UILabel *labelTemperature;
@property (nonatomic, strong) UIImageView *imageDay;
@property (nonatomic, strong) UIImageView *imageNight;

@property (nonatomic, strong) UILabel *labeldate1;
@property (nonatomic, strong) UILabel *labelWind1;
@property (nonatomic, strong) UIImageView *imageDay1;
@property (nonatomic, strong) UIImageView *imageNight1;

@property (nonatomic, strong) UILabel *labeldate2;
@property (nonatomic, strong) UILabel *labelWind2;
@property (nonatomic, strong) UIImageView *imageDay2;
@property (nonatomic, strong) UIImageView *imageNight2;

@end
@implementation YIem_SY_One_Bottom_View

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        // 1
        self.labeldate = [[UILabel alloc] init];
        self.labeldate.numberOfLines = 2;
        self.labeldate.textColor = [UIColor whiteColor];
        [self addSubview:self.labeldate];
        
        self.labelWind = [[UILabel alloc] init];
        self.labelWind.numberOfLines = 2;
        self.labelWind.textColor = [UIColor whiteColor];
        [self addSubview:self.labelWind];
        
        self.imageDay = [[UIImageView alloc] init];
        [self addSubview:self.imageDay];
        
        self.imageNight = [[UIImageView alloc] init];
        [self addSubview:self.imageNight];
        
        // 2
        self.labeldate1 = [[UILabel alloc] init];
        self.labeldate1.numberOfLines = 2;
        self.labeldate1.textColor = [UIColor whiteColor];
        [self addSubview:self.labeldate1];
        
        self.labelWind1 = [[UILabel alloc] init];
        self.labelWind1.numberOfLines = 2;
        self.labelWind1.textColor = [UIColor whiteColor];
        [self addSubview:self.labelWind1];
        
        self.imageDay1 = [[UIImageView alloc] init];
        [self addSubview:self.imageDay1];
        
        self.imageNight1 = [[UIImageView alloc] init];
        [self addSubview:self.imageNight1];
        
        // 3
        self.labeldate2 = [[UILabel alloc] init];
        self.labeldate2.numberOfLines = 2;
        self.labeldate2.textColor = [UIColor whiteColor];
        [self addSubview:self.labeldate2];
        
        self.labelWind2 = [[UILabel alloc] init];
        self.labelWind2.numberOfLines = 2;
        self.labelWind2.textColor = [UIColor whiteColor];
        [self addSubview:self.labelWind2];
        
        self.imageDay2 = [[UIImageView alloc] init];
        [self addSubview:self.imageDay2];
        
        self.imageNight2 = [[UIImageView alloc] init];
        [self addSubview:self.imageNight2];
        


    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.labeldate.frame = CGRectMake(0, 0, self.frame.size.width / 2, self.frame.size.height / 3);
    self.labelWind.frame = CGRectMake(self.labeldate.frame.size.width, 0, self.frame.size.width - self.labeldate.frame.size.width, self.labeldate.frame.size.height);
    //
    self.labeldate1.frame = CGRectMake(0, self.labeldate.frame.origin.y + self.labeldate.frame.size.height, self.labeldate.frame.size.width, self.labeldate.frame.size.height);
    self.labelWind1.frame = CGRectMake(self.labeldate.frame.size.width, self.labeldate.frame.origin.y + self.labeldate.frame.size.height, self.labeldate.frame.size.width, self.labeldate.frame.size.height);
    //
    self.labeldate2.frame = CGRectMake(0, self.labeldate1.frame.origin.y + self.labeldate1.frame.size.height, self.labeldate.frame.size.width, self.labeldate.frame.size.height);
    self.labelWind2.frame = CGRectMake(self.labeldate.frame.size.width, self.labeldate1.frame.origin.y + self.labeldate1.frame.size.height, self.labeldate.frame.size.width, self.labeldate.frame.size.height);
    
    
    
    
    
}
- (void)setArr:(NSMutableArray *)arr
{
    _arr = arr;
    
    YIem_SY_One_Model *model = [[YIem_SY_One_Model alloc] init];
    self.labeldate.text = [NSString stringWithFormat:@" %@ \n %@", [[arr objectAtIndex:1] date], [[arr objectAtIndex:1] weather]];
    self.labelWind.text = [NSString stringWithFormat:@"%@ \n%@", [[arr objectAtIndex:1] wind] , [[arr objectAtIndex:1] temperature]];
    
    self.labeldate1.text = [NSString stringWithFormat:@" %@ \n %@", [[arr objectAtIndex:2] date], [[arr objectAtIndex:2] weather]];
    self.labelWind1.text = [NSString stringWithFormat:@"%@ \n%@", [[arr objectAtIndex:2] wind] , [[arr objectAtIndex:2] temperature]];
    
    self.labeldate2.text = [NSString stringWithFormat:@" %@ \n %@", [[arr objectAtIndex:3] date], [[arr objectAtIndex:3] weather]];
    self.labelWind2.text = [NSString stringWithFormat:@"%@ \n%@", [[arr objectAtIndex:3] wind] , [[arr objectAtIndex:3] temperature]];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
